Skip to content

Add a fuzzy rule canonicalising the SCP wiki's alias hosts - #424

Merged
benoit74 merged 1 commit into
mainfrom
scp-fuzzy-rules
Dec 4, 2026
Merged

benoit74 merged 1 commit into
mainfrom
scp-fuzzy-rules

Conversation

@benoit74

@benoit74 benoit74 commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #423, which has the full rationale and evidence.

scp-wiki.wikidot.com, scpwiki.com, www.scpwiki.com and www.scp-wiki.net all serve the English SCP wiki with 200 OK rather than a redirect, and pages link across them freely — SCP-4558's own ListPages pager points at http://www.scp-wiki.net/scp-4558/offset/1. Without canonicalisation the same article lands at several ZIM paths and cross-host links resolve to nothing: on a 10-page crawl, 30 escaped links whose target was in the ZIM under the canonical host, and SCP-4558's whole offset chain stored only under alias hosts.

Two details worth a reviewer's attention, both covered by tests:

  • The pattern is anchored with ^, unlike most rules in this file, because it rewrites the host. Sibling language branches live on subdomains of these very domains (ko.scp-wiki.net), and an unanchored match would rewrite them onto the English wiki.
  • unreplace_pattern is the never-matching (?!): the forward rule cannot know which alias a canonical URL came from, and most scp-wiki.wikidot.com URLs were never aliased, so mapping them back would be wrong far more often than right. defuzzify then finds no matching unrule and returns the canonical URL unchanged, in both the Python and JS implementations.

scp-wiki.wikidot.com, scpwiki.com, www.scpwiki.com and www.scp-wiki.net all
serve the same wiki with HTTP 200 rather than a redirect, and pages link across
them freely. Without canonicalisation the same article lands at several ZIM
paths and cross-host links resolve to nothing: on a 10-page crawl, 30 escaped
links whose target was in the ZIM under the canonical host, and SCP-4558's
whole offset chain stored only under alias hosts.

Driver: openzim/zim-requests#402.
@benoit74 benoit74 self-assigned this Dec 4, 2026
@codecov

codecov Bot commented Dec 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (0f8b295) to head (813b365).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #424   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           42        42           
  Lines         2990      2990           
  Branches       457       457           
=========================================
  Hits          2990      2990           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@benoit74
benoit74 merged commit d085ce0 into main Dec 4, 2026
10 checks passed
@benoit74
benoit74 deleted the scp-fuzzy-rules branch December 4, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fuzzy rule canonicalising the SCP wiki's alias hosts

1 participant